//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.枚举右_维护左;

import java.util.HashSet;
import java.util.Set;

public class demo_2001 {
    public demo_2001() {
    }

    public long interchangeableRectangles(int[][] rectangles) {
        long count = 0L;
        Set<Double> set = new HashSet();

        for(int[] rectangle : rectangles) {
            boolean add = set.add((double)rectangle[1] / (double)rectangle[0]);
            if (!add) {
                ++count;
            }
        }

        if (count == 0L) {
            return count;
        } else {
            long avg = 1L;

            for(long i = 2L; i <= count; ++i) {
                avg *= i;
            }

            return avg;
        }
    }
}
